﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VirtualTournaments.DataAccess;
using VirtualTournaments.DataAccess.EntityManagers;

namespace VirtualTournaments.Services.Tournaments
{
    public class JourneysService
    {
        public static Journey GetLastJourneyByTournamentName(String tournamentName)
        {
            ITournamentsManager tournamentData = DataAccessManager.EntityManagersFactory.GetTournamentsManager();

            Business.Tournaments.Tournament bizTournament = tournamentData.GetByExactName(tournamentName);

            Journey lastJourney = new Journey();

            do
            {
                lastJourney.addMatch(lastJourney.GetEnumerator().Current);
            } while (lastJourney.GetEnumerator().MoveNext());


            return lastJourney;
        }
    }
}

